]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell-recorder: Avoid a crash when the cursor texture is NULL
authorRui Matos <tiagomatos@gmail.com>
Mon, 6 Jun 2016 18:28:34 +0000 (20:28 +0200)
committerRui Matos <tiagomatos@gmail.com>
Tue, 28 Jun 2016 17:03:33 +0000 (19:03 +0200)
When running as a wayland compositor, MetaCursorTracker might
legitimately not have a displayed cursor because e.g. a client unsets
the cursor surface.

Note that, under an X session, the assumption that the tracker always
has a cursor texture is true because XFixesGetCursorImage() always
returns data even if the cursor isn't visible.

https://bugzilla.gnome.org/show_bug.cgi?id=767001

src/shell-recorder.c

index ef729ff5fda67dd349cf41baed629834f923d98a..e7562ef01f6301344c641b2ad15a5cbddf3db4b4 100644 (file)
@@ -321,6 +321,9 @@ recorder_fetch_cursor_image (ShellRecorder *recorder)
   guint8 *data;
 
   texture = meta_cursor_tracker_get_sprite (recorder->cursor_tracker);
+  if (!texture)
+    return;
+
   width = cogl_texture_get_width (texture);
   height = cogl_texture_get_height (texture);
   stride = 4 * width;